<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/taglibs-session.tld" prefix="sess"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="tur.br.moradadosol.util.Util"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cadastro de Tarifas</title>
<LINK rel="stylesheet" href="css/style.css" type="text/css">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<script language="JavaScript" src="js/validacao.js"></script>
<script type="text/javascript">
function editarTarifa(cod) {
	document.forms[0].codigo.value = cod;
	document.forms[0].inicio.value = '';
	document.forms[0].fim.value = '';
	document.forms[0].valor.value = 0;
}
</script>
</head>
<body>
<BODY class="pagina">
<P align="left"><jsp:include page="/jsp/sistema/pageheader.jsp"
	flush="true" /> <html:form action="valordiaria">

	<html:hidden name="valorDiariaForm" property="codigo"/>

	<table border="0" width="90%">
		<tr>
			<td align="center" class="titulo" colspan="6">Cadastro de Tarifas</td>
		</tr>
		<tr>
			<TD class="texto">De</TD>
			<TD class="texto">Até</TD>
			<TD class="texto">Número de Pessoas</TD>
			<TD class="texto">Valor</TD>
			<TD class="texto" width="100">&nbsp;</TD>
		</tr>
		<tr>
			<TD class="texto">
				<html:text name="valorDiariaForm" property="inicio" size="10" maxlength="10" styleClass="componente_obrigatorio" onkeyup="formata_data(this,event);" onkeypress="return Apenas_Numeros(event);"/>
				(dd/mm/aaaa)
			</TD>
			<TD class="texto">
				<html:text name="valorDiariaForm" property="fim" size="10" maxlength="10" styleClass="componente_obrigatorio" onkeyup="formata_data(this,event);" onkeypress="return Apenas_Numeros(event);"/>
				(dd/mm/aaaa)
			</TD>
			<TD class="texto" valign="top">
				<html:text name="valorDiariaForm" property="quantidade" size="4" maxlength="2" styleClass="componente_obrigatorio" onkeypress="return verificar_valor(event);" />
				</TD>
			<TD class="texto">
				<html:text name="valorDiariaForm" property="valor" size="10" maxlength="10" styleClass="componente_obrigatorio" onkeypress="return verificar_valor(event);" />
				(R$)
			</TD>
			<TD class="texto" valign="middle">
				<logic:equal name="valorDiariaForm" property="codigo" value="0">
					<input type="submit" value="Cadastrar" name="gravar" class="componente" />
				</logic:equal> <logic:notEqual name="valorDiariaForm" property="codigo" value="0">
					<input type="submit" value="Gravar" name="gravar" class="componente" />
					<br>
					<input type="submit" value="Excluir" name="deletar"	class="componente" />
				</logic:notEqual>
			</TD>
		</tr>
		<logic:messagesPresent>
			<TR>
				<TD colspan="6" align="center" class="erro"><html:errors /></TD>
			</TR>
		</logic:messagesPresent>
		<logic:notEmpty name="valorDiariaForm" property="diarias">
			<logic:iterate name="valorDiariaForm" property="diarias" id="diaria"
				type="tur.br.moradadosol.model.ValorDiaria" indexId="ind">
				<tr bgcolor="<%=(ind%2==0?"#D2DCFF":"#E6ECFF")%>">
					<TD class="texto"><%=Util.getDate(diaria.getInicio())%></TD>
					<TD class="texto"><%=Util.getDate(diaria.getFim())%></TD>
					<TD class="texto"><%=diaria.getQuantidade()%></TD>
					<TD class="texto"><%=Util.getValorFormatado(diaria.getValor())%>
					</TD>
					<TD class="texto" valign="middle">
					<input type="submit" value="Editar" name="editar"
						class="componente"
						onclick="editarTarifa(<%=diaria.getCodigo()%>);" /></TD>
				</tr>
			</logic:iterate>
			
		</logic:notEmpty>
		<tr>
			<td align="center" class="titulo" colspan="6">
				* Esta pesquisa apresenta apenas os períodos vigentes e futuros.
			</td>
		</tr>
	</table>

</html:form> <jsp:include page="/jsp/sistema/pagefooter.jsp" flush="true" /></P>

</body>
</html>
